/**
 * This file is part of 1genia trampoline
 * Copyright (C) 2007-2008 1genia (contact@1genia.com)
 *
 * This library is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; version 3 of the License. 
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details. 
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; see the file COPYING.TXT.  If not,
 * write to the Free Software Foundation, Inc., 51 Franklin Street,
 * Fifth Floor, Boston, MA 02110-1301, USA. 
 **/
package com.genia.toolbox.basics.proxy.methods.interceptors;

import java.lang.reflect.Method;

import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

/**
 * a method interceptor always returning null.
 */
public class NullMethodIntercetor
    implements MethodInterceptor
{
  /**
   * One instance is enough.
   */
  public static final NullMethodIntercetor INSTANCE = new NullMethodIntercetor();



  /**
   * All generated proxied methods call this method instead of the original
   * method. The original method may either be invoked by normal reflection
   * using the Method object, or by using the MethodProxy (faster).
   * 
   * @param obj
   *          "this", the enhanced object
   * @param method
   *          intercepted Method
   * @param args
   *          argument array; primitive types are wrapped
   * @param proxy
   *          used to invoke super (non-intercepted method); may be called as
   *          many times as needed
   * @throws Throwable
   *           any exception may be thrown; if so, super method will not be
   *           invoked
   * @return any value compatible with the signature of the proxied method.
   *         Method returning void will ignore this value.
   * @see MethodProxy
   * @see net.sf.cglib.proxy.MethodInterceptor#intercept(java.lang.Object,
   *      java.lang.reflect.Method, java.lang.Object[],
   *      net.sf.cglib.proxy.MethodProxy)
   */
  public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy)
      throws Throwable
  {
    return null;
  }

}